<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div class="list"> 
      <div
        class="list-left" 
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style5/exhibitiondisplayBoardtyle1bg1.webp'})`,
        }"
      >
        <img :src="publicUrls + 'free/style5/exhibitiondisplayBoardtyle1bg3.webp'" alt="" />
      </div>
      <div 
        class="exhibits-parent" 
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style5/exhibitiondisplayBoardtyle1bg5.webp'})`,
        }"
      >
        <div
          @contextmenu.stop="emit('onContextMenuChild', $event, index)"
          v-for="(item, index) in props.info.showpieceList"
          :key="index"
          class="exhibits-item"
        >
          <div class="item-content"> 
            <div class="cover-box" @click="viewImg(item.moduleId, item.id)">
              <img
                class="cover"
                v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')"
                alt=""
                
              />
              <FlowerCom />
            </div> 
            <p 
              class="items-title"
              :style="{
                backgroundImage: `url(${
                  publicUrls + 'free/style5/exhibitiondisplayBoardtyle1bg6.webp'
                })`,
              }"
            >  
              {{ item.name }}
            </p>
          </div>
        </div>
      </div> 
      <div 
        class="list-right"
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style5/exhibitiondisplayBoardtyle1bg2.webp'})`,
        }"
      >
        <img :src="publicUrls + 'free/style5/exhibitiondisplayBoardtyle1bg4.webp'" alt="" />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import FlowerCom from "./flower.vue"
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  padding: 0 !important;
   -webkit-box-reflect: below 24% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.list {
  display: flex;
  padding: 0 0.2rem;
  width: 100%;
  height: 100%;
  padding-top: 0.1rem;
}
.list-left,
.list-right {
  display: flex;
  width: 157px;
  height: 500px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  img {
    margin-top: 120px;
    width: 40px;
    height: 202px;
  }
}
.list-left {
  justify-content: flex-end;
  img {
    // margin-right: -15px; 
  }
}
.list-right {
  img {
    // margin-left: -15px;
  }
}
.exhibits-parent {
  display: flex;
  flex: 1;
  height: 202px;
  margin-top: 120px;
  background-repeat: repeat; 
  background-size: auto  202px;
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}


.exhibits-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 250px;
  height: 317px;
}

.item-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 250px; 
  height: 317px;  
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.cover-box {
  position: relative;
  width: 180px;
  height: 180px;
  overflow: hidden;
  margin-top: 57px; 
  border: 2px solid rgba(154, 175, 170, 1);
  box-shadow: 4px 0px 0px 0px #899E99;
  background: rgba(239, 240, 238, 1);
}
.cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: all 0.3s;
}
.cover-box:hover {
  .cover {
    transform: scale(1.2);
  }
}
.items-title {
  padding: 19px 8px; 
  background-repeat: no-repeat;
  background-size: 100% 100%;
  width: 180px;
  height: 62px;
  font-family: SourceHanSerifCN-Bold;
  font-size: 18px;
  color: rgba(63, 95, 92, 1);
  line-height: 24px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 18px;
}
</style>
